﻿namespace Blaze.Framework
{
    using UnityEngine;

    /// <summary>
    /// 为<see cref="Camera"/>提供常用的扩展功能。
    /// </summary>
    public static class CameraExtension
    {
        /// <summary>
        /// 增加Layer到CullingMask。
        /// </summary>
        /// <param name="camera">摄像机</param>
        /// <param name="layer">需要增加的层</param>
        public static void AddCullingMask(this Camera camera, int layer)
        {
            camera.cullingMask |= 1 << layer;
        }

        /// <summary>
        /// 从CullingMask移除Layer。
        /// </summary>
        /// <param name="camera">摄像机</param>
        /// <param name="layer">需要移除的层</param>
        public static void RemoveCullingMask(this Camera camera, int layer)
        {
            camera.cullingMask &= ~(1 << layer);
        }
    }
}